<template>
  <div class="detail">
    <!-- 左侧导航 -->
    <el-aside width="200px" class="aside">
      <el-menu
        default-active="2"
        class="el-menu-vertical-demo"
        text-color="#fff"
        active-text-color="#ffd04b"
        background-color="#545c64"
        router
      >
        <!--无子集 -->
        <el-menu-item :index="basePath" v-if="!item.child">
          <i class="el-icon-menu"></i>
          <span slot="title">{{ item.name }}</span>
        </el-menu-item>
        <!-- 有子集 -->
        <el-submenu :index="basePath" v-else>
          <template slot="title">
            <i class="el-icon-location"></i>
            <span>{{ item.name }}</span>
          </template>
          <NavItem
            v-for="child in item.child"
            :key="child.url"
            :item="child"
            :basePath="child.url"
          />
        </el-submenu>
      </el-menu>
    </el-aside>
  </div>
</template>

<script>
export default {
  name: "NavItem",
  data() {
    return {};
  },
  props: ["item", "basePath"],
  methods: {},
};
</script>

<style  lang="less" scoped>
</style>
